<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/5/31
  Time: 12:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>所有课程</h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="#">Home</a></li>
                        <li class="breadcrumb-item active">所有课程</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="card">
            <!-- /.card-header -->
            <div class="card-body">
                <%--          <div id="jsGrid1"></div>--%>

                <section class="content">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-12">
                                <div class="card">
                                    <div class="card-header">
                                        <h3 class="card-title">所有课程信息</h3>&emsp;&emsp;
                                    </div>
                                    <!-- /.card-header -->
                                    <div class="card-body">
                                        <table id="example2" class="table table-bordered table-hover">
                                            <thead>
                                            <tr>
                                                <th>课程名</th>
                                                <th>上课周</th>
                                                <th>时间</th>
                                                <th>专业</th>
                                                <th>授课老师</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <c:if test="${sessionScope.courses == null}">
                                                <h2>暂无您可选择的课程</h2>
                                            </c:if>
                                            <c:if test="${sessionScope.courses != null}">
                                                <c:forEach items="${sessionScope.courses}" var="course">


                                                    <tr>
                                                        <td>${course.CName}</td>
                                                        <td>${course.week}</td>
                                                        <td>${course.begin1}-${course.end1}</td>
                                                        <td>${course.CMajor}</td>
                                                        <td>${course.CTeacher}</td>
                                                        <td>
                                                            <a href="addStudentCourse/${course.id}/${sessionScope.UID}">
                                                                <button type="button"
                                                                        class="btn btn-block bg-gradient-info">添加课程
                                                                </button>
                                                            </a>
                                                        </td>
                                                    </tr>

                                                </c:forEach>
                                            </c:if>

                                            </tbody>
                                        </table>
                                    </div>
                                    <!-- /.card-body -->
                                </div>
                                <!-- /.card -->
                            </div>
                            <!-- /.col -->
                        </div>
                        <!-- /.row -->
                    </div>
                    <!-- /.container-fluid -->
                </section>

            </div>
            <!-- /.card-body -->
        </div>
        <!-- /.card -->
    </section>
    <!-- /.content -->
</div>